document.addEventListener('DOMContentLoaded', function() {
  document.querySelectorAll('.show-content').forEach(function(link) {
    link.addEventListener('click', function() {
      const mainContent = this.getAttribute('data-main');
      const rightContent = this.getAttribute('data-right');
      showMainContent(mainContent);
      document.querySelectorAll('.main-item').forEach(function(item) {
        item.addEventListener('click', function() {
          const detail = rightContent.split(' ')[item.textContent === 'D' ? 1 : 0];
          document.getElementById('right-content').textContent = detail;
        });
      });
    });
  });
});

function showMainContent(mainContent) {
  const items = mainContent.split(' ');
  const mainContentDiv = document.getElementById('main-content');
  mainContentDiv.innerHTML = ''; // 清空当前内容
  items.forEach(function(item) {
    mainContentDiv.innerHTML += `<a href="javascript:void(0);" class="main-item">${item}</a>`;
  });
}